import re
from common.custom_task_data import CustomTaskData

class CustomTaskRejectWord:
    def __init__(self):
        self.custom_task = CustomTaskData()
        pass

    def check(self, task_id, reject_word):
        reject_list = reject_word.split(",")
        records = self.custom_task.query_task_detail_all(task_id)
        for r in records:
            for reject in reject_list:
                if reject == "":
                    continue
                if re.search(reject, r[3]):
                    self.custom_task.update_task_detail_status(r[0])
                    break
    def do(self):
        tasks = self.custom_task.query_task_all()
        for task in tasks:
            self.check(task[0], task[2])


s_tools = CustomTaskRejectWord()
s_tools.do()
#print(s_tools.get_similarities('埃尔托生物霍乱',3))
